home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / DELPHI / RAS.ZIP / RASCOMP3.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-04-03  |  19.5 KB  |  696 lines

  1. {$LONGSTRINGS ON}
  2. unit Rascomp32;
  3.  
  4. {-------------------------------------------------
  5. DELPHI 2.0 RAS COMPONENT
  6. (C) 1996 Daniel Polistchuck
  7. }
  8.  
  9. {
  10. This is a Delphi 2.0 wrapper for the RAS & W95 Dial-Up Connection
  11. client services. It was tested and re-tested. But, anyway, there is
  12. always something that can be missing or wrong. Please, feel free to
  13. contact me at
  14.  
  15. danpol@br.homeshopping.com.br
  16.  
  17. This component is a rewrite of the excelent Mike Armstrong's
  18. (compuserve 72740,1145) TRAS component. Parts of it were
  19. rewritten in order to conform to the 32 bits RAS Api, whose
  20. prototypes are included in the RAS_API32 unit source code.
  21.  
  22. Daniel Polistchuck
  23. with collaborations from Ronaldo Smith Jr.
  24. }
  25.  
  26.  
  27. interface
  28.  
  29. uses
  30.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  31.   Forms, Dialogs, RAS_API32;
  32.  
  33.  
  34. const
  35.   MaxConnections = 4;
  36.  
  37. type
  38.   TConnectionList = class(TList)
  39.     function AddConnection(Connection: TRASConn): Word;
  40.     function RASConn(Index: Integer): HRASConn;
  41.     function EntryName(Index: Integer): String;
  42.     procedure Delete(Index: Integer);
  43.   end;
  44.  
  45.   TRasStateEvent = Procedure( Sender: TObject; Error: Longint; ErrorString: String) of Object;
  46.  
  47.   TRAS = class(TComponent)
  48.   private
  49.     { Private declarations }
  50.     FEntryName,
  51.     FPhoneNumber,
  52.     FPhoneBookPath,
  53.     FCallbackNumber,
  54.     FUserName,
  55.     FPassword,
  56.     FDomain,
  57.     FDeviceType,
  58.     FDeviceName: String;
  59.     FRedialAttempts: Integer;
  60.     fOnCallback,
  61.     fOnConnect,
  62.     fAboutToOpenPort,
  63.     fPortOpened,
  64.     fAboutToConnDev,
  65.     fDevConnected,
  66.     fAllDevsConnected,
  67.     fAuthenticate,
  68.     fAuthNotify,
  69.     fAuthRetry,
  70.     fAuthCallBack,
  71.     fAuthChangePassword,
  72.     fAuthProject,
  73.     fAuthLinkSpeed,
  74.     fAuthAck,
  75.     fReAuthenticate,
  76.     fAuthenticated,
  77.     fPrepareforCallback,
  78.     fWaitForModemReset,
  79.     fInteractiveStarted,
  80.     fRetryAuth,
  81.     fPasswordExpired : TNotifyEvent;
  82.     fOnDisconnect : TRasStateEvent;
  83.     fWindowHandle: HWND;
  84.     RASEvent: Word;
  85.  
  86.     procedure SetPhoneBookPath(Value: String);
  87.     procedure Connected;
  88.     procedure DisConnected;
  89.     procedure WaitingForCallBack;
  90.     procedure AboutToOpenPort;
  91.     procedure PortOpened;
  92.     procedure AboutToConnDev;
  93.     procedure DevConnected;
  94.     procedure AllDevsConnected;
  95.     procedure Authenticate;
  96.     procedure AuthNotify;
  97.     procedure AuthRetry;
  98.     procedure AuthCallBack;
  99.     procedure AuthChangePassword;
  100.     procedure AuthProject;
  101.     procedure AuthLinkSpeed;
  102.     procedure AuthAck;
  103.     procedure ReAuthenticate;
  104.     procedure Authenticated;
  105.     procedure PrepareforCallback;
  106.     procedure WaitForModemReset;
  107.     procedure InteractiveStarted;
  108.     procedure RetryAuth;
  109.     procedure PasswordExpired;
  110.     Procedure SetRedialAttempts( Value: Integer );
  111.  
  112.     procedure WndProc(var Msg: TMessage);
  113.     function IntDisConnect: LongInt; { Used internally to bypass fOnDisconnect }
  114.   protected
  115.     { Protected declarations }
  116.   public
  117.     { Public declarations }
  118.     PhoneBookEntries: TStringList;
  119.     Connections: TConnectionList;
  120.     LastError: LongInt;
  121.     RASConn: HRASConn;   { Connection handle}
  122.     ConnectState: Word;
  123.     CONSTRUCTOR Create(AOwner: TComponent); OVERRIDE;
  124.     DESTRUCTOR Destroy; override;
  125.     FUNCTION GetConnectStatus: LongInt;
  126.     FUNCTION DisConnect: LongInt;
  127.     FUNCTION GetErrorString(ErrorCode: LongInt): String;
  128.     FUNCTION Connect: LongInt;
  129.     FUNCTION CurrentStatus: String;
  130.     FUNCTION GetConnections: LongInt;
  131.     FUNCTION GetPhoneBookEntries: LongInt;
  132.  
  133.   PUBLISHED
  134.     { Published declarations }
  135.     PROPERTY EntryName:   String          read fEntryName write fEntryName;
  136.     PROPERTY PhoneNumber: String          read fPhoneNumber write fPhoneNumber;
  137.     PROPERTY PhoneBookPath:  String       read fPhoneBookPath write SetPhoneBookPath;
  138.     PROPERTY CallbackNumber: String       read fCallbackNumber write fCallbackNumber;
  139.     PROPERTY UserName:    String          read fUserName write fUserName;
  140.     PROPERTY Password:    String          read fPassword write fPassword;
  141.     PROPERTY RedialAttempts: Integer      read FRedialAttempts write SetRedialAttempts default 1;
  142.     PROPERTY Domain:      String          read fDomain write fDomain;
  143.     PROPERTY DeviceType:  String          read fDeviceType write fDeviceType;
  144.     PROPERTY DeviceName:  String          read fDeviceName write fDeviceName;
  145.     PROPERTY OnConnect:    TNotifyEvent   read fOnconnect write fOnConnect;
  146.     PROPERTY OnDisconnect: TRasStateEvent read fOnDisconnect write fOnDisconnect;
  147.     PROPERTY OnCallBack:   TNotifyEvent   read fOnCallBack write fOnCallBack;
  148.     PROPERTY OnAboutToOpenPort:TNotifyEvent read fAboutToOpenPort write fAboutToOpenPort;
  149.     PROPERTY OnPortOpened:     TNotifyEvent read fPortOpened write fPortOpened;
  150.     PROPERTY OnAboutToConnDev: TNotifyEvent read fAboutToConnDev write fAboutToConnDev;
  151.     PROPERTY OnDevConnected:   TNotifyEvent read fAllDevsConnected write fAllDevsConnected;
  152.     PROPERTY OnAllDevsConnected: TNotifyEvent read fAllDevsConnected write fAllDevsConnected;
  153.     PROPERTY OnAuthenticate:   TNotifyEvent read fAuthenticate write fAuthenticate;
  154.     PROPERTY OnAuthNotify:     TNotifyEvent read fAuthNotify write fAuthNotify;
  155.     property OnAuthRetry:      TNotifyEvent read fAuthRetry write fAuthRetry;
  156.     property OnAuthCallBack:   TNotifyEvent read fAuthCallBack write fAuthCallBack;
  157.     property OnAuthChangePassword: TNotifyEvent read fAuthChangePassword write fAuthChangePassword;
  158.     property OnAuthProject:    TNotifyEvent read fAuthProject write fAuthProject;
  159.     property OnAuthLinkSpeed:  TNotifyEvent read fAuthLinkSpeed write fAuthLinkSpeed;
  160.     property OnAuthAck:        TNotifyEvent read fAuthAck write fAuthAck;
  161.     property OnReAuthenticate: TNotifyEvent read fReAuthenticate write fReAuthenticate;
  162.     property OnAuthenticated:  TNotifyEvent read fAuthenticated write fAuthenticated;
  163.     property OnPrepareforCallback: TNotifyEvent read fPrepareforCallback write fPrepareforCallback;
  164.     property OnWaitForModemReset:  TNotifyEvent read fWaitForModemReset write fWaitForModemReset;
  165.     property OnInteractiveStarted: TNotifyEvent read fInteractiveStarted write fInteractiveStarted;
  166.     property OnRetryAuth:       TNotifyEvent read fRetryAuth write fRetryAuth;
  167.     property OnPasswordExpired: TNotifyEvent read fPasswordExpired write fPasswordExpired;
  168.   end;
  169.  
  170. procedure Register;
  171.  
  172. implementation
  173.  
  174. procedure Register;
  175. begin
  176.   RegisterComponents('RAS', [TRAS]);
  177. end;
  178.  
  179. { ********************************************************************* }
  180. {                           TConnectionList                             }
  181. { ********************************************************************* }
  182. function TConnectionList.AddConnection(Connection: TRASConn): Word;
  183. var
  184.   Conn: PRASConn;
  185. begin
  186.   Conn := New(PRASConn);
  187.   Conn^ := Connection;
  188.   Add(Conn);
  189. end;
  190.  
  191. function TConnectionList.RASConn(Index: Integer): HRASConn;
  192. begin
  193.   Result := PRASConn(Items[Index])^.RASConn;
  194. end;
  195.  
  196. function TConnectionList.EntryName(Index: Integer): String;
  197. begin
  198.   If PRASConn(Items[Index])^.szEntryName[0] <> #0 THEN
  199.      Result := StrPas(PRASConn(Items[Index])^.szEntryName)
  200.   ELSE
  201.      Result := '';
  202. end;
  203.  
  204. procedure TConnectionList.Delete(Index: Integer);
  205. begin
  206.   Dispose( PRASConn( Items[ Index ] ) );
  207.   Items[ Index ] := Nil;
  208.  
  209.   Inherited Delete( Index );
  210. end;
  211.  
  212. { ********************************************************************* }
  213. {                            TRASConnection                             }
  214. { ********************************************************************* }
  215. CONSTRUCTOR TRAS.Create(AOwner: TComponent);
  216. begin
  217.   inherited Create(AOwner);
  218.   RASEvent := RegisterWindowMessage(RASDialEvent);
  219.   If RASEvent = 0 THEN
  220.      RASEvent := WM_RASDialEvent;
  221.  
  222.   RASConn := 0;
  223.   ConnectState := 0;
  224.   fWindowHandle := 0;
  225.  
  226.   FRedialAttempts := 1;
  227.  
  228.   PhoneBookEntries := TStringList.Create;
  229.   Connections := TConnectionList.Create;
  230. end;
  231.  
  232. destructor TRAS.Destroy;
  233. begin
  234.   IntDisconnect;
  235.   PhoneBookEntries.Free;
  236.   Connections.Free;
  237.   inherited Destroy;
  238. end;
  239.  
  240. function TRAS.Connect: LongInt;
  241. var
  242.   RASDialParams: TRASDialParams;{ points to calling parameters }
  243.   R: LongInt;
  244. begin
  245.   If RASConn <> 0 THEN { Allow only one connection }
  246.      IntDisConnect;
  247.   If fWindowHandle = 0 THEN
  248.      fWindowHandle := AllocateHWnd(WndProc);
  249.   FillChar(RASDialParams, SizeOf(RASDialParams), #0);
  250.   RasConn := 0;
  251.   With RASDialParams DO
  252.   Begin
  253.     dwSize := SizeOf(TRASDialParams);
  254.     UniqueString(fEntryName);
  255.     StrLCopy(szEntryName, PChar((fEntryName)), RAS_MaxEntryName);
  256.     UniqueString(fPhoneNumber);
  257.     StrLCopy(szPhoneNumber, PChar(fPhoneNumber), RAS_MaxPhoneNumber);
  258.     UniqueString(fCallBackNumber);
  259.     StrLCopy(szCallbackNumber, PChar((fCallBackNumber)), RAS_MaxCallbackNumber);
  260.     UniqueString(fUserName);
  261.     StrLCopy(szUserName,PChar((fUserName)) , UNLEN);
  262.     UniqueString(fPassWord);
  263.     StrLCopy(szPassword, PChar((fPassWord)), PWLEN);
  264.     UniqueString(fDomain);
  265.     StrLCopy(szDomain, Pchar(fDomain), DNLEN);
  266.   End;
  267.   If fPhoneBookPath <> '' THEN
  268.   Begin
  269.     LastError := RasDial(Nil, PChar(fPhoneBookPath), @RASDialParams, $FFFFFFFF, fWindowHandle, RASConn);
  270.   End
  271.   ELSE
  272.     LastError := RasDial(Nil, Nil, @RASDialParams,$FFFFFFFF,  fWindowHandle, RASConn);
  273.   Result := LastError;
  274. end;
  275.  
  276. function TRAS.GetErrorString(ErrorCode: LongInt): String;
  277. var
  278.   szErrorString: Array[0..256] of Char;
  279. begin
  280.   Result := '';
  281.   If (RASConn = 0) THEN
  282.      Exit;
  283.   FillChar(szErrorString, SizeOf(szErrorString), #0);
  284.   RasGetErrorString(ErrorCode, szErrorString, 256);
  285.   If szErrorString[0] <> #0 THEN
  286.      Result := StrPas(szErrorString)
  287.   Else
  288.      Result := 'Status Unknown';
  289. end;
  290.  
  291. function TRAS.Disconnect: LongInt;
  292. begin
  293.   Result := 0;
  294.   If RASConn <> 0 THEN
  295.      Result := RASHangUp(RASConn);
  296.   RASConn := 0;
  297.   If fWindowHandle <> 0 THEN { Stop message flow }
  298.   Begin
  299.     DeallocateHWnd(fWindowHandle);
  300.     fWindowHandle := 0;
  301.   End;
  302.   LastError := Result;
  303.   Disconnected;
  304. end;
  305.  
  306. function TRAS.IntDisconnect: LongInt;
  307. begin
  308.   Result := 0;
  309.   If RASConn <> 0 THEN
  310.      Result := RASHangUp(RASConn);
  311.   RASConn := 0;
  312.   If fWindowHandle <> 0 THEN { Stop message flow }
  313.   Begin
  314.     DeallocateHWnd(fWindowHandle);
  315.     fWindowHandle := 0;
  316.   End;
  317.   LastError := Result;
  318. end;
  319.  
  320. function TRAS.GetConnectStatus: LongInt;
  321. var
  322.   RASConnStatus: TRASConnStatus;
  323. begin
  324.   If (RASConn = 0) THEN
  325.      Exit;
  326.   FillChar(RASConnStatus, SizeOf(RASConnStatus), #0);
  327.   RASConnStatus.dwSize := SizeOf (RasConnStatus);
  328.   LastError := RasGetConnectStatus(RASConn, @RASConnStatus);
  329.   If LastError = 0 THEN
  330.   begin
  331.     fDeviceName := StrPas(RASConnStatus.szDeviceName);
  332.     fDeviceType := StrPas(RASConnStatus.szDeviceType);
  333.     ConnectState := RASConnStatus.rasconnstate;
  334.   end;
  335.   LastError := RASConnStatus.dwError;
  336.   Result := LastError;
  337. end;
  338.  
  339. function TRAS.GetConnections: LongInt;
  340. var
  341.   RASConnect: Array[1..MaxConnections] OF TRASConn;
  342.   I,
  343.   BufSize,
  344.   NumConnections: DWord;
  345. begin
  346.   Connections.Clear;
  347.   RASConnect[1].dwSize := Sizeof (RASConnect[1]);
  348.   BufSize := SizeOf(RASConnect);
  349.   Result := RasEnumConnections(@RASConnect, BufSize, NumConnections);
  350.   LastError := Result;
  351.   If (Result = 0) OR (Result = ERROR_BUFFER_TOO_SMALL) THEN
  352.      For I := 1 TO NumConnections DO
  353.          If (I <= MaxConnections) THEN
  354.             Connections.AddConnection(RASConnect[I]);
  355. end;
  356.  
  357. function TRAS.GetPhoneBookEntries;
  358. var
  359.   RASEntryName: Array[1..20] Of TRASENTRYNAME;
  360.   I,
  361.   BufSize,
  362.   Entries: DWord;
  363.   szPhoneBookPath: PChar;
  364. begin
  365.   PhoneBookEntries.Clear;
  366.   RASEntryName[1].dwSize := SizeOf(RASEntryName[1]);
  367.   BufSize := SizeOf(RASEntryName);
  368.   If fPhoneBookPath <> '' THEN
  369.   Begin
  370.     GetMem(szPhoneBookPath, Length(fPhoneBookPath) + 1);
  371.     StrPCopy(szPhoneBookPath, fPhoneBookPath);
  372.     Result := RasEnumEntries(Nil, szPhonebookPath, @RASEntryName,
  373.                              BufSize, Entries);
  374.     FreeMem(szPhoneBookPath, Length(fPhoneBookPath) + 1);
  375.   End
  376.   ELSE
  377.     Result := RasEnumEntries(Nil, Nil, @RASEntryName, BufSize, Entries);
  378.   LastError := Result;
  379.   If (Result = 0) OR (Result = ERROR_BUFFER_TOO_SMALL) THEN
  380.      For I := 1 TO Entries DO
  381.          If ( I < 21) AND (RASEntryName[I].szEntryName[0] <> #0) THEN
  382.             PhoneBookEntries.Add(StrPas(RASEntryName[I].szEntryName));
  383. end;
  384.  
  385. procedure TRAS.WndProc(var Msg: TMessage);
  386. begin
  387.   If (Msg.Msg = RASEvent) AND (RASConn <> 0) THEN
  388.   Begin
  389.     If Msg.lParam <> 0 THEN
  390.        LastError := Msg.lParam
  391.     ELSE
  392.     Begin
  393.       ConnectState := Msg.wParam;
  394.       Case ConnectState OF
  395. {           RASCS_DeviceConnected: DeviceConnected;}
  396.            {Daniel's Addition}
  397.            RASCS_OpenPort : AboutToOpenPort;
  398.            RASCS_PortOpened : PortOpened;
  399.            RASCS_ConnectDevice : AboutToConnDev;
  400.            RASCS_DeviceConnected : DevConnected;
  401.            RASCS_AllDevicesConnected : AllDevsConnected;
  402.            RASCS_Authenticate : Authenticate;
  403.            RASCS_AuthNotify : AuthNotify;
  404.            RASCS_AuthRetry : AuthRetry;
  405.            RASCS_AuthCallback : AuthCallBack;
  406.            RASCS_AuthChangePassword : AuthChangePassword;
  407.            RASCS_AuthProject : AuthProject;
  408.            RASCS_AuthLinkSpeed : AuthLinkSpeed;
  409.            RASCS_AuthAck : AuthAck;
  410.            RASCS_ReAuthenticate : ReAuthenticate;
  411.            RASCS_Authenticated : Authenticated;
  412.            RASCS_PrepareForCallback : PrepareforCallback;
  413.            RASCS_WaitForModemReset : WaitForModemReset;
  414.            RASCS_Interactive : InteractiveStarted;
  415.            RASCS_RetryAuthentication : RetryAuth;
  416.            RASCS_PasswordExpired : PasswordExpired;
  417.            RASCS_Connected    : Connected;
  418.            RASCS_DisConnected : Disconnected;
  419.            RASCS_WaitForCallBack: WaitingForCallBack;
  420.       End;
  421.     End;
  422.     CurrentStatus;
  423.   End
  424.   ELSE
  425.      DefWindowProc(fWindowHandle, Msg.Msg, Msg.wParam, Msg.lParam);
  426. end;
  427.  
  428. Procedure TRAS.SetRedialAttempts( Value: Integer );
  429. Begin
  430.   IF ( FRedialAttempts <> Value ) THEN
  431.   BEGIN
  432.     FRedialAttempts := Value;
  433.   END;
  434. End;
  435.  
  436. FUNCTION TRAS.CurrentStatus: String;
  437. BEGIN
  438.   Result := '';
  439.   If (RASConn = 0) THEN
  440.   Begin
  441.     Result := 'Not Active';
  442.     Exit;
  443.   End;
  444.   If RASConn <> 0 THEN
  445.   Begin
  446.     GetConnectStatus;
  447.     If LastError <> 0 THEN
  448.     Begin
  449.       If LastError >= 600 THEN
  450.          Result := GetErrorString(LastError)
  451.       ELSE
  452.       Case LastError OF
  453.         6: Result := 'Invalid Handle';
  454.         8: Result := 'Not enough memory';
  455.       End;
  456.     End
  457.     ELSE
  458.     Case ConnectState OF
  459.      RASCS_OpenPort:
  460.             Result := 'Opening Port';
  461.      RASCS_PortOpened:
  462.             Result := 'Port Opened';
  463.      RASCS_ConnectDevice:
  464.             Result := 'Using Device: ' + fDeviceName + ' - ' + fDeviceType;
  465.      RASCS_DeviceConnected:
  466.             Result := 'Device is connected';
  467.      RASCS_AllDevicesConnected:
  468.             Result := 'All Required Devices Connected';
  469.      RASCS_Authenticate:
  470.             Result := 'Validating User/Password/Domain';
  471.      RASCS_AuthNotify:
  472.             Result := 'Authentication Notification';
  473.      RASCS_AuthCallBack:
  474.             Result := 'Authentication Call Back';
  475.      RASCS_AuthProject:
  476.             Result := 'Project';
  477.      RASCS_AuthLinkSpeed:
  478.             Result := 'Calculating Link speed';
  479.      RASCS_AuthAck:
  480.             Result := 'Authentication acknowledged';
  481.      RASCS_ReAuthenticate:
  482.             Result := 'Reauthenticating';
  483.      RASCS_Authenticated:
  484.             Result := 'Login Authenticated';
  485.      RASCS_PrepareforCallBack:
  486.             Result := 'Preparing for Callback';
  487.      RASCS_WaitForModemReset:
  488.             Result := 'Waiting for Modem Reset';
  489.      RASCS_WaitForCallBack:
  490.             Result := 'Waiting for Callback';
  491.     End; { Case }
  492.   End
  493.   ELSE
  494.     Result := 'Not Connected';
  495. end;
  496.  
  497. PROCEDURE TRAS.SetPhoneBookPath( Value: String );
  498. BEGIN
  499.   fPhoneBookPath := Value;
  500.   GetPhoneBookEntries;
  501. END;
  502.  
  503. PROCEDURE TRAS.Connected;
  504. BEGIN
  505.   If ( RASConn = 0 ) THEN
  506.     Exit;
  507.   If Assigned( fOnConnect ) THEN
  508.     fOnConnect( Self );
  509. END;
  510.  
  511. PROCEDURE TRAS.AboutToOpenPort;
  512. BEGIN
  513.   If (RASConn = 0) THEN
  514.      Exit;
  515.   If Assigned(fAboutToOpenPort) THEN
  516.      fAboutToOpenPort (Self);
  517. end;
  518.  
  519. procedure TRAS.PortOpened;
  520. begin
  521.   If (RASConn = 0) THEN
  522.      Exit;
  523.   If Assigned(fPortOpened) THEN
  524.      fPortOpened(Self);
  525. end;
  526.  
  527. procedure TRAS.AboutToConnDev;
  528. begin
  529.   If (RASConn = 0) THEN
  530.      Exit;
  531.   If Assigned(fAboutToConnDev) THEN
  532.      fAboutToConnDev (Self);
  533. end;
  534.  
  535. procedure TRAS.DevConnected;
  536. begin
  537.   If (RASConn = 0) THEN
  538.      Exit;
  539.   If Assigned(fDevConnected) THEN
  540.      fDevConnected(Self);
  541. end;
  542.  
  543. procedure TRAS.AllDevsConnected;
  544. begin
  545.   If (RASConn = 0) THEN
  546.      Exit;
  547.   If Assigned(fAllDevsConnected) THEN
  548.      fAllDevsConnected(Self);
  549. end;
  550.  
  551. procedure TRAS.Authenticate;
  552. begin
  553.   If (RASConn = 0) THEN
  554.      Exit;
  555.   If Assigned(fAuthenticate) THEN
  556.      fAuthenticate(Self);
  557. end;
  558.  
  559. procedure TRAS.AuthNotify;
  560. begin
  561.   If (RASConn = 0) THEN
  562.      Exit;
  563.   If Assigned(fAuthNotify) THEN
  564.      fAuthNotify(Self);
  565. end;
  566.  
  567. procedure TRAS.AuthRetry;
  568. begin
  569.   If (RASConn = 0) THEN
  570.      Exit;
  571.   If Assigned(fAuthRetry) THEN
  572.      fAuthRetry(Self);
  573. end;
  574.  
  575. procedure TRAS.AuthCallBack;
  576. begin
  577.   If (RASConn = 0) THEN
  578.      Exit;
  579.   If Assigned(fAuthCallBack) THEN
  580.      fAuthCallBack(Self);
  581. end;
  582.  
  583. procedure TRAS.AuthChangePassword;
  584. begin
  585.   If (RASConn = 0) THEN
  586.      Exit;
  587.   If Assigned(fAuthChangePassword) THEN
  588.      fAuthChangePassword(Self);
  589. end;
  590.  
  591. procedure TRAS.AuthProject;
  592. begin
  593.   If (RASConn = 0) THEN
  594.      Exit;
  595.   If Assigned(fAuthProject) THEN
  596.      fAuthProject(Self);
  597. end;
  598.  
  599. procedure TRAS.AuthLinkSpeed;
  600. begin
  601.   If (RASConn = 0) THEN
  602.      Exit;
  603.   If Assigned(fAuthLinkSpeed) THEN
  604.      fAuthLinkSpeed(Self);
  605. end;
  606.  
  607. procedure TRAS.AuthAck;
  608. begin
  609.   If (RASConn = 0) THEN
  610.      Exit;
  611.   If Assigned(fAuthAck) THEN
  612.      fAuthAck(Self);
  613. end;
  614.  
  615. procedure TRAS.ReAuthenticate;
  616. begin
  617.   If (RASConn = 0) THEN
  618.      Exit;
  619.   If Assigned(fReAuthenticate) THEN
  620.      fReAuthenticate(Self);
  621. end;
  622.  
  623. procedure TRas.Authenticated;
  624. begin
  625.   If (RASConn = 0) THEN
  626.      Exit;
  627.   If Assigned(fAuthenticated) THEN
  628.      fAuthenticated(Self);
  629. end;
  630.  
  631. procedure TRAS.PrepareforCallback;
  632. begin
  633.   If (RASConn = 0) THEN
  634.      Exit;
  635.   If Assigned(fPrepareforCallback) THEN
  636.      fPrepareforCallback(Self);
  637. end;
  638.  
  639. procedure TRAS.WaitForModemReset;
  640. begin
  641.   If (RASConn = 0) THEN
  642.      Exit;
  643.   If Assigned(fWaitForModemReset) THEN
  644.      fWaitForModemReset(Self);
  645. end;
  646.  
  647. procedure TRAS.InteractiveStarted;
  648. begin
  649.   If (RASConn = 0) THEN
  650.      Exit;
  651.   If Assigned(fInteractiveStarted) THEN
  652.      fInteractiveStarted(Self);
  653. end;
  654.  
  655. procedure TRAS.RetryAuth;
  656. begin
  657.   If (RASConn = 0) THEN
  658.      Exit;
  659.   If Assigned(fRetryAuth) THEN
  660.      fRetryAuth(Self);
  661. end;
  662.  
  663. procedure TRAS.PasswordExpired;
  664. begin
  665.   If (RASConn = 0) THEN
  666.      Exit;
  667.   If Assigned(fPasswordExpired) THEN
  668.      fPasswordExpired(Self);
  669. end;
  670.  
  671. procedure TRAS.DisConnected;
  672. var
  673.   RasConnStatus : TRasConnStatus;
  674.   LastError : Longint;
  675.   ErrorStr : String;
  676. begin
  677.   If Assigned(fOnDisConnect) THEN
  678.   begin
  679.     FillChar(RASConnStatus, SizeOf(RASConnStatus), #0);
  680.     RASConnStatus.dwSize := Sizeof (RasConnStatus);
  681.     LastError := RasGetConnectStatus(RASConn, @RASConnStatus);
  682.     ErrorStr := GetErrorString (LastError);
  683.     fOnDisConnect(Self,LastError,ErrorStr);
  684.   end;
  685. end;
  686.  
  687. procedure TRAS.WaitingForCallBack;
  688. begin
  689.   If (RASConn = 0) THEN
  690.      Exit;
  691.   If Assigned(fOnCallBack) THEN
  692.      fOnCallBack(Self);
  693. end;
  694.  
  695. end.
  696.